<?php
include $this->Render('header.php');
//include $this->Render('sys_menu.php');
?>
<style type="text/css">
.ext-strict .x-form-text {
	background:#fff;
	border:1px solid #e1e1e1;
	height:22px;	
}

.x-form .x-panel {
	margin-bottom:5px;
}
/**
.x-form-check-group {
	border:1px solid #e1e1e1;
	background:#FFF;
}
**/
</style>

<!--S 公共顶部-->
<div id="page-north">
    <?php
		include $this->Render('nav.php');
	?>
    
    <!-- S 查询条件 -->
    <div class="admin-search-box admin-search-reset">
        <ul class="admin-search-ul J-admin-search-box">
        	<li>
                关键字：
                <input type="text" name="keyword" value="" placeholder="输入关键字" />
            </li>
            <li>
                <a class="nc-btn-input J-btn-search" href="javascript:;">查询</a>
            </li>
			<?php
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'add'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-jia" href="javascript:;"><em class="ico-jia mr5"></em>新增</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'edit'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-xiugai" href="javascript:;"><em class="ico-xiugai mr5"></em>编辑</a>
            </li>
			<?php
				}
				if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'remove'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-del" href="javascript:;"><em class="ico-del mr5"></em>删除</a>
            </li>
			<?php
				}
                if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'auditconfig'))){
			?>
            <li>
                <a class="nc-btn-input J-ico-shpeizhi" href="javascript:;"><em class="ico-xiugai mr5"></em>网点审核配置</a>
            </li>
            <?php
                }
                if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'contractlist'))){
            ?>
            <li>
                <a class="nc-btn-input J-ico-htguanli" href="javascript:;"><em class="ico-xiugai mr5"></em>网点合同管理</a>
            </li>
            <?php
                }
                if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'bankaccountedit'))){
            ?>
            <li>
                <a class="nc-btn-input J-ico-bankxiugai" href="javascript:;"><em class="ico-xiugai mr5"></em>银行账号编辑</a>
            </li>
            <?php
                }
                if(Purview::checkPurview($this->UserConfig['Id'],array('crm','sys','branch', 'unadmittance'))){
            ?>
            <li>
                <a class="nc-btn-input J-ico-unadmittance" href="javascript:;"><em class="ico-xiugai mr5"></em>网点上牌地限制</a>
            </li>
            <?php 
                }
            ?>

        </ul>
        <div class="clear"></div>
    </div>
    <!-- E 查询条件 -->
    
</div>
<!--E 公共顶部 -->

<!-- S 数据列表 -->
<div id="topic-grid"></div>
<!-- E 数据列表 -->
<input type="hidden" name="dpid" value="<?php echo $this->dpid; ?>" />
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/branch.js?v=<?php echo time();?>"></script>
<script type="text/javascript">
$(document).ready(function(e) {
    $(".J-ico-shpeizhi").on('click',function(){
        peizhiItem(); 
    });

    $(".J-ico-htguanli").on('click',function(){
        guanliItem(); 
    });
    $(".J-ico-bankxiugai").on('click',function(){
        bankeditItem(); 
    });

    });

function peizhiItem(){
    var count = App.grid.getSelectionModel().getCount();
    if(count < 1){
        Ext.Msg.minWidth = 120;
        Ext.Msg.alert('提示','请选择选项');    
        return false;   
    }
    
    var selectRow = App.grid.getSelectionModel();
    var selectObj = selectRow.getSelected();
    var br_id = selectObj['data']['br_id'];

    //弹出窗口
    var peizhiHtml = '<iframe width="100%" height="100%" id="peizhi_item" name="peizhi_item" src="/branch/operate/option/auditconfig?id='+br_id+'" frameborder="0">" frameborder="0"></iframe>';
    var win = new Ext.Window({
            title:'网点审核配置',
            closeable:true,
            closeAction:'hide',
            modal:true,
            width:700,
            height:400,
            resizable:false,
            plain:true,
            layout:'fit',
            html:peizhiHtml
        });
        win.show(this); 
}

function guanliItem(){
    var count = App.grid.getSelectionModel().getCount();
    if(count < 1){
        Ext.Msg.minWidth = 120;
        Ext.Msg.alert('提示','请选择选项');    
        return false;
    }
    
    var selectRow = App.grid.getSelectionModel();
    var selectObj = selectRow.getSelected();
    var br_id = selectObj['data']['br_id'];
window.location.href='/branch/operate/option/contractlist/?id='+br_id+'';
}

function bankeditItem(){
    var count = App.grid.getSelectionModel().getCount();
    if(count < 1){
        Ext.Msg.minWidth = 120;
        Ext.Msg.alert('提示','请选择选项');    
        return false;   
    }
    
    var selectRow = App.grid.getSelectionModel();
    var selectObj = selectRow.getSelected();
    var br_id = selectObj['data']['br_id'];

    //弹出窗口
    var bankeditHtml = '<iframe width="100%" height="100%" id="peizhi_item" name="peizhi_item" src="/branch/operate/option/bankaccountedit?brid='+br_id+'" frameborder="0">" frameborder="0"></iframe>';
    var win = new Ext.Window({
            title:'网点银行账号编辑',
            closeable:true,
            closeAction:'hide',
            modal:true,
            width:500,
            height:400,
            resizable:false,
            plain:true,
            layout:'fit',
            html:bankeditHtml
        });
        win.show(this);  
}

</script>
<?php include $this->Render('footer.php'); ?>
